package main

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"go-interview-forum/global"
	"go-interview-forum/initialize"
	"go-interview-forum/route"
	"log"
)

var (
	port = "9999"
)

func main() {
	// 初始化操作
	initialize.AppInitialize()
	// 框架启动
	g := gin.Default()

	g.Use(cors.New(global.CorsOptions)) // 跨域
	// 路由
	route.Router(g)
	log.Println("test")
	log.Println("listen and server: ", port)
	err := g.Run(":" + port)
	if err != nil {
		log.Println("fail to start:", err)
		panic(err)
	}
}
